# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Run.V2.Model.GoogleCloudRunV2Container do
  @moduledoc """
  A single application container. This specifies both the container to run, the command to run in the container and the arguments to supply to it. Note that additional arguments can be supplied by the system to the container at runtime.

  ## Attributes

  *   `args` (*type:* `list(String.t)`, *default:* `nil`) - Arguments to the entrypoint. The docker image's CMD is used if this is not provided.
  *   `command` (*type:* `list(String.t)`, *default:* `nil`) - Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided.
  *   `dependsOn` (*type:* `list(String.t)`, *default:* `nil`) - Names of the containers that must start before this container.
  *   `env` (*type:* `list(GoogleApi.Run.V2.Model.GoogleCloudRunV2EnvVar.t)`, *default:* `nil`) - List of environment variables to set in the container.
  *   `image` (*type:* `String.t`, *default:* `nil`) - Required. Name of the container image in Dockerhub, Google Artifact Registry, or Google Container Registry. If the host is not provided, Dockerhub is assumed.
  *   `livenessProbe` (*type:* `GoogleApi.Run.V2.Model.GoogleCloudRunV2Probe.t`, *default:* `nil`) - Periodic probe of container liveness. Container will be restarted if the probe fails.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Name of the container specified as a DNS_LABEL (RFC 1123).
  *   `ports` (*type:* `list(GoogleApi.Run.V2.Model.GoogleCloudRunV2ContainerPort.t)`, *default:* `nil`) - List of ports to expose from the container. Only a single port can be specified. The specified ports must be listening on all interfaces (0.0.0.0) within the container to be accessible. If omitted, a port number will be chosen and passed to the container through the PORT environment variable for the container to listen on.
  *   `resources` (*type:* `GoogleApi.Run.V2.Model.GoogleCloudRunV2ResourceRequirements.t`, *default:* `nil`) - Compute Resource requirements by this container.
  *   `startupProbe` (*type:* `GoogleApi.Run.V2.Model.GoogleCloudRunV2Probe.t`, *default:* `nil`) - Startup probe of application within the container. All other probes are disabled if a startup probe is provided, until it succeeds. Container will not be added to service endpoints if the probe fails.
  *   `volumeMounts` (*type:* `list(GoogleApi.Run.V2.Model.GoogleCloudRunV2VolumeMount.t)`, *default:* `nil`) - Volume to mount into the container's filesystem.
  *   `workingDir` (*type:* `String.t`, *default:* `nil`) - Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :args => list(String.t()) | nil,
          :command => list(String.t()) | nil,
          :dependsOn => list(String.t()) | nil,
          :env => list(GoogleApi.Run.V2.Model.GoogleCloudRunV2EnvVar.t()) | nil,
          :image => String.t() | nil,
          :livenessProbe => GoogleApi.Run.V2.Model.GoogleCloudRunV2Probe.t() | nil,
          :name => String.t() | nil,
          :ports => list(GoogleApi.Run.V2.Model.GoogleCloudRunV2ContainerPort.t()) | nil,
          :resources => GoogleApi.Run.V2.Model.GoogleCloudRunV2ResourceRequirements.t() | nil,
          :startupProbe => GoogleApi.Run.V2.Model.GoogleCloudRunV2Probe.t() | nil,
          :volumeMounts => list(GoogleApi.Run.V2.Model.GoogleCloudRunV2VolumeMount.t()) | nil,
          :workingDir => String.t() | nil
        }

  field(:args, type: :list)
  field(:command, type: :list)
  field(:dependsOn, type: :list)
  field(:env, as: GoogleApi.Run.V2.Model.GoogleCloudRunV2EnvVar, type: :list)
  field(:image)
  field(:livenessProbe, as: GoogleApi.Run.V2.Model.GoogleCloudRunV2Probe)
  field(:name)
  field(:ports, as: GoogleApi.Run.V2.Model.GoogleCloudRunV2ContainerPort, type: :list)
  field(:resources, as: GoogleApi.Run.V2.Model.GoogleCloudRunV2ResourceRequirements)
  field(:startupProbe, as: GoogleApi.Run.V2.Model.GoogleCloudRunV2Probe)
  field(:volumeMounts, as: GoogleApi.Run.V2.Model.GoogleCloudRunV2VolumeMount, type: :list)
  field(:workingDir)
end

defimpl Poison.Decoder, for: GoogleApi.Run.V2.Model.GoogleCloudRunV2Container do
  def decode(value, options) do
    GoogleApi.Run.V2.Model.GoogleCloudRunV2Container.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Run.V2.Model.GoogleCloudRunV2Container do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
